package org.flexthinker.binding.form
{
    import org.flexthinker.binding.validation.FormModelValidator;
    import org.flexthinker.binding.validation.ValidationResultsModel;

    import mx.validators.Validator;

    public interface ValidatingFormModel
    {
        /**
         * Returns the ValidationResultsModel which encapsulates the set of
         * validation messages currently active against this form model. Will be
         * empty if validation is disabled.
         */
        function getValidationResults():ValidationResultsModel;

        /**
         * Does this ValidatingFormModel or any of its children contain errors?
         */
        // function getHasErrors():Boolean;

        /**
         * Is this form model currently validating?
         */
        function isValidating():Boolean;

        /**
         * Sets whether or not validation is currently enabled for this form model.
         * If validation is enabled the form model will immediately validate all
         * form properties. If validation is disabled all validation messages held
         * by the ValidationResultsModel will be cleared.
         */
        function setValidating( validating:Boolean ):void;

        /**
         * Forces the form model to validate its self. If validation is disabled it
         * does nothing.
         */
        function validate():void;

        /**
         * Get the validator that will be used to validate the form model.
         */
        function getValidator():FormModelValidator;

        /**
         * Set the validator that will be used to validate the form model.
         */
        function setValidator( validator:FormModelValidator ):void;
    }
}